//
//  RSImgVScrollView.h
//  RSUIScrollView
//
//  Created by thinkjoy on 16/8/26.
//  Copyright © 2016年 Thinkjoy_RS. All rights reserved.
//  无限滚动视图,需要用到SDWebImage

#import <UIKit/UIKit.h>
#import <QuartzCore/QuartzCore.h>

@class RSImgVScrollView;

/**
 *  PageControll的位置
 */
typedef NS_ENUM(NSInteger,RSImgVScrollViewPageControllPosition) {
    /**
     *  默认,底部中心
     */
    RSImgVScrollViewPageControllPositionCenter = 0,
    /**
     *  左下角
     */
     RSImgVScrollViewPageControllPositionLeft,
    /**
     *  右下角
     */
     RSImgVScrollViewPageControllPositionRight,
    /**
     *  隐藏
     */
     RSImgVScrollViewPageControllPositionHidden,
};

/**
 *  RSImgVScrollView自动滚动类型
 */
typedef NS_ENUM(NSInteger,RSImgVScrollViewRollingType) {
    /**
     *  无限向左循环滚动,
     */
    RSImgVScrollViewRollingTypeInfiniteLoopLeft =   0,
    /**
     无限向右循环滚动,
     */
    RSImgVScrollViewRollingTypeInfiniteLoopRight,
    /**
     *  无限左右循环滚动
     */
    RSImgVScrollViewRollingTypeSingleLoop,
    /**
     *  禁止自动滚动
     */
    RSImgVScrollViewRollingTypeunabledLoop,
};

@protocol RSImgVScrollViewDataSource<NSObject>

@required
/**图片地址数组,可以是UIImage,NSData,NSURL,NSString(地址)类型混编*/
- (NSArray *)arrayWithImagesInImgVScrollView:(RSImgVScrollView *)imgVScrollView;

/**图片填充类型*/
- (UIViewContentMode)imgVScrollView:(RSImgVScrollView *)imgVScrollView contentModeForImgAtIndex:(NSInteger)index;

@optional
/**图片数组是NSURL类型,请求片时默认填充的图片,默认填充类型和图片填充类型相同*/
- (UIImage *)imgVScrollView:(RSImgVScrollView *)imgVScrollView placeHolderImageAtIndex:(NSInteger)index;

/**图片数组为nil时,默认填充的图片和*/
- (UIImage *)placeHolderImageForImgVScrollView;
/**图片数组为nil时,默认填充图片的填充类型*/
- (UIViewContentMode)placeHolderImageVContentModeForImgVScrollView;

@end

@protocol RSImgVScrollViewDelegate<NSObject>

- (void)imgVScrollView:(RSImgVScrollView *)imgVScrollView didSelectImageAtIndex:(NSUInteger)index;

@end

@interface RSImgVScrollView : UIView

@property   (nonatomic,assign)  id <RSImgVScrollViewDataSource>     dataSource;

@property   (nonatomic,assign)  id <RSImgVScrollViewDelegate>       delegate;


/**
 *  轮播图滑到边界时是否可以继续滑动,YES=可以,NO=不可以,默认为YES
 */
@property   (nonatomic,assign)  BOOL  bounces;

/**
 *  PageControll的位置,默认,底部中心
 */
@property   (nonatomic,assign)    RSImgVScrollViewPageControllPosition  pageControllPosition;

/**轮播图只有一张图片时,是否隐藏指示器(UIPageControl),YES=隐藏,NO=显示,默认隐藏*/
@property   (nonatomic,assign) BOOL hidePageControlForSinglePages; // Defaults YES

/** RSImgVScrollView滚动类型,默认无限向左滚动 */
@property   (nonatomic,assign)  RSImgVScrollViewRollingType  scrollType;

/**轮播图只有一张图片时,是否允许继续轮播和左右滑动,YES=允许,NO=禁止,默认NO*/
@property   (nonatomic,assign)  BOOL  scrollEnabledForSinglePages; // Defaults NO

/** *  循环间断时间 */
@property   (nonatomic,assign)  NSTimeInterval  intervalTime;


/**
 *  自定义设置分页指示器的颜色
 *
 *  @param currentColor 选中得颜色
 *  @param otherColor   其他颜色
 */
- (void)setpageControlCurrentColor:(UIColor *)currentColor OtherColor:(UIColor *)otherColor;

//- (instancetype)initWithFrame:(CGRect)frame;

/*

 
 @required
 
 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section;
 
 // Row display. Implementers should *always* try to reuse cells by setting each cell's reuseIdentifier and querying for available reusable cells with dequeueReusableCellWithIdentifier:
 // Cell gets various attributes set automatically based on table (separators) and data source (accessory views, editing controls)
 
 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;
 
 @optional
 
 - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView;              // Default is 1 if not implemented
 
 - (nullable NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section;    // fixed font style. use custom view (UILabel) if you want something different
 - (nullable NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section;
 
 // Editing
 
 // Individual rows can opt out of having the -editing property set for them. If not implemented, all rows are assumed to be editable.
 - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath;
 
 // Moving/reordering
 
 // Allows the reorder accessory view to optionally be shown for a particular row. By default, the reorder control will be shown only if the datasource implements -tableView:moveRowAtIndexPath:toIndexPath:
 - (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath;
 
 // Index
 
 - (nullable NSArray<NSString *> *)sectionIndexTitlesForTableView:(UITableView *)tableView __TVOS_PROHIBITED;                                                    // return list of section titles to display in section index view (e.g. "ABCD...Z#")
 - (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index __TVOS_PROHIBITED;  // tell table which section corresponds to section title/index (e.g. "B",1))
 
 // Data manipulation - insert and delete support
 
 // After a row has the minus or plus button invoked (based on the UITableViewCellEditingStyle for the cell), the dataSource must commit the change
 // Not called for edit actions using UITableViewRowAction - the action's handler will be invoked instead
 - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath;
 
 // Data manipulation - reorder / moving support
 
 - (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath;
 
 @end
 // This category provides convenience methods to make it easier to use an NSIndexPath to represent a section and row
 @interface NSIndexPath (UITableView)
 
 + (instancetype)indexPathForRow:(NSInteger)row inSection:(NSInteger)section;
 
 @property (nonatomic, readonly) NSInteger section;
 @property (nonatomic, readonly) NSInteger row;
 
 @end*/
@end
